import { JSEncrypt } from 'jsencrypt'
import Vue from 'vue'
// 加密
Vue.prototype.$encryptionData=function(publickey,pwd){
    let encrypt = new JSEncrypt()
    //设置公钥
    encrypt.setPublicKey(publickey)
    //password是要加密的数据,此处不用注意+号,因为rsa自己本身已经base64转码了,不存在+,全部是二进制数据
    let result = encrypt.encrypt(pwd)
    return result
}
// 解密
Vue.prototype.$decryptData = function (privateKey,secretpwd){
    let decrypt = new JSEncrypt()
   
    decrypt.setPrivateKey(privateKey)
 
    let result = decrypt.decrypt(secretpwd)
    return result
}